package com.google.common.base;

import java.util.Collection;

public class Joiner {

    private final char sp;

    private Joiner(char sp) {
        this.sp = sp;
    }

    public static Joiner on(char sp){
        return new Joiner(sp);
    }

    public <T> String join(Collection<T> args){
        StringBuilder stringBuilder = new StringBuilder();
        boolean first = true;
        for(Object arg : args){
            if(first){
                first = false;
            } else {
                stringBuilder.append(sp);
            }
            stringBuilder.append(arg);
        }
        return stringBuilder.toString();
    }
}
